﻿#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include <string>
using namespace std;

template<class T1, class T2>
class PersonTemplateMember
{
public:
	PersonTemplateMember(T1 name, T2 age);
	/*{
		this->m_Name = name;
		this->m_Age = age;
	}*/
	void showPerson();
	/*{
		cout << "姓名：" << this->m_Name << " 年龄：" << this->m_Age << endl;
	}*/

	T1 m_Name;
	T2 m_Age;
};
//1.类外实现成员函数；
template<class T1, class T2>
PersonTemplateMember<T1, T2>::PersonTemplateMember(T1 name, T2 age)
{
	this->m_Name = name;
	this->m_Age = age;
}
template<class T1, class T2>
void PersonTemplateMember<T1, T2>::showPerson()
{
	cout << "姓名：" << this->m_Name << " 年龄：" << this->m_Age << endl;
}
void testOutClassMember()
{
	PersonTemplateMember<string, int>p("钱学森", 30);
	p.showPerson();//姓名：钱学森 年龄：30
}

//main304：类模板的类外实现成员函数
int main304()
{
	testOutClassMember();

	system("pause");
	return EXIT_SUCCESS;
}